<?php
/*
 * Created on 22.12.2008
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
include_once '../wrapper/JF_String.php';
include_once '../wrapper/JF_Float.php';
include_once '../wrapper/JF_Int.php';

include_once '../wrapper/JF_Bool.php';

class JF_URIParamUtil {

	public static function getValue($sType, $mValue) {

		switch ($sType) {
			case 'int':
				$oValue = new JF_Int($mValue);
				break;
			case 'float':
				$oValue = new JF_Float($mValue);
				break;
			case 'bool':
				$oValue = new JF_Bool($mValue);
				break;
			default:
				$oValue = new JF_String($mValue);
				break;
		}

		return $oValue->get();
	}

	public static function detectValue($mValue) {
		if ((string)(int)$mValue == $mValue) {
			$oValue = new JF_Int($mValue);
		}
		else if ((string)(float)$mValue == $mValue) {
			$oValue = new JF_Float($mValue);
		}
		else if ((string)(bool)$mValue == $mValue) {
			$oValue = new JF_Bool($mValue);
		}
		else if ($mValue == 'true') {
			$oValue = new JF_Bool($mValue);
		}
		else if ($mValue == 'false') {
			$oValue = new JF_Bool($mValue);
		}
		else {
			$oValue = new JF_String($mValue);
		}

		return $oValue;
	}

	public static function detectType($mValue) {
		if ((string)(int)$mValue == $mValue) {
			$sType	= 'int';
		}
		else if ((string)(float)$mValue == $mValue) {
			$sType	= 'float';
		}
		else if ($mValue == 'true') {
			$sType	= 'bool';
		}
		else if ($mValue == 'false') {
			$sType	= 'bool';
		}
		else {
			$sType	= 'string';
		}

		return $sType;
	}

}




